package com.lc.luzhengtang.adapter;

import android.view.ViewGroup;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.lc.luzhengtang.R;
import com.lc.luzhengtang.bean.CommentList;
import com.lc.luzhengtang.conn.Conn;
import com.zcx.helper.scale.ScaleScreenHelperFactory;

import java.util.List;

/**
 * https://github.com/CymChad/BaseRecyclerViewAdapterHelper
 */
public class SectionItemAdapter2 extends BaseQuickAdapter<CommentList.DataBeanXX.DataBeanX.IndexBean.DataBean, BaseViewHolder> {

    List<CommentList.DataBeanXX.DataBeanX.IndexBean.DataBean> data;

    public SectionItemAdapter2(List<CommentList.DataBeanXX.DataBeanX.IndexBean.DataBean> data) {
        super(R.layout.item_comment_secotion2, data);
        this.data = data;
    }


    @Override
    protected void convert(BaseViewHolder helper, CommentList.DataBeanXX.DataBeanX.IndexBean.DataBean item) {
        ScaleScreenHelperFactory.getInstance().loadView((ViewGroup) helper.convertView);


        Glide.with(mContext).load(Conn.HOST3 + item.getPicurl()).crossFade().error(R.mipmap.ic_launcher).into((ImageView) helper.getView(R.id.img_shop));
        helper.setText(R.id.text_newstime, item.getGoods_title());
        helper.setText(R.id.text_newstitle, item.getGoods_price());
        helper.setText(R.id.text_price, item.getContent());
        helper.setText(R.id.text_num, item.getNum() + "");
        helper.setText(R.id.text_content, item.getContent());

//        1好评 2中评 3差评
        if (item.getEvaluate().equals("1")) {
            helper.setText(R.id.text_status, "好评");
            helper.setImageResource(R.id.img_status, R.mipmap.comment_selected);
            helper.setVisible(R.id.textView4, false);
        } else if (item.getEvaluate().equals("2")) {
            helper.setText(R.id.text_status, "中评");
            helper.setImageResource(R.id.img_status, R.mipmap.comment_unselected);
            helper.setVisible(R.id.textView4, false);
        } else {
            helper.setText(R.id.text_status, "差评");
            helper.setImageResource(R.id.img_status, R.mipmap.comment_unselected);
            helper.setVisible(R.id.textView4, true);
        }


    }
}
